using UnityEditor;
using UnityEngine;

namespace DA.AnimGraph.Editor {
    public class PreviewWindow : EditorWindow {
        private PreviewEnv previewEnv;
        static PreviewWindow NewWindow(string title) {
            var window = ScriptableObject.CreateInstance(typeof(PreviewWindow)) as PreviewWindow;
            window.titleContent = new GUIContent(title);
            return window;
        }

        public static void OpenWindow() {
            var window = NewWindow("Preview Window");
            window.Show();
        }

        private PreviewSelector previewSelector;
        private PreviewAGTree previewAgTree;

        private void OnEnable() {
            Init();
        }
        void Init() {
            previewEnv = new();
            previewSelector = new PreviewSelector(previewEnv);
            previewAgTree = new PreviewAGTree(previewEnv);
            rootVisualElement.Add(previewSelector);
            rootVisualElement.Add(previewAgTree);
        }

    }
}
